January 25, 2014

In files, it's a zip called PHSNA_standard_rev_3r00.zip.

I added four functions, or sort-of functions:  RLB/SWR, Scan, Memories, and Input curve fit polynomials to save in EEPROM.

RLB:
The RLB/SWR thing is for use with your return loss bridge (RLB).  You input a frequency range or a single frequency.  You are prompted to open or short the unknown terminal and make that measurement, then connect the unknown to measure return loss, SWR and reflectance coefficient magnitude.

If you are scanning, the printout is in CSV format so you can move or paste your spreadsheet easily.

You also have the option of continuous updating of the readings at a fixed frequency so you can adjust your network (antenna tuner, etc.) while watching the result.

Memories:

You can input up to ten memories numbered 0 through 9 to be saved to EEPROM.  Simply pressing the key moves the DDS to the corresponding memory.  All memories are displayed on entry to this function.  There's an option to clear memories.

Scan:

This function allows you to enter a low and high frequency, step size and delay time between steps.  The DDS then scans per those parameters continuously until you hit a key.  If you want to change a parameter, you can hit a key corresponding to it and make the change without having to re-do the entire set-up process.  There's a pause key that stops the scan and displays the current frequency.

Enter Polynomial Coefficients for storage in EEPROM:

Now you don't have to edit the source code to enter these numbers.  Use Jim's spreadsheet that's on the site to calculate the coefficients and this menu option to enter them.  There's also an option to clear them all back to zero, giving uncompensated dBm readings.

New menu structure:

With the menu getting a bit crowded, there's now a main menu for "normal use" functions and a secondary one for preferences, calibrations, etc.  

Other changes:

I made some other cosmetic and human factors changes.  On the main menu and in most places, you no longer have to hit enter after hitting your "choice" key. Snappier operation.

Program size, etc:

Program size has gotten up to 30K out of an available 32K, so there's not much room for major additions.  There are some programming inefficiencies that could be fixed to allow a little more room, but it's still finite.

I realized while doing some changes that the use of "float" values for frequency data limits the resolution to be greater than 1 Hz when the frequency gets above 9 MHz or so. Actually, a "double" data type is used, but on the Arduino this is the same as a float. I spent one full day trying to change everything to an unsigned long integer, which can handle the resolution I wanted.  But computing the phase increment involves a little arithmetic on the order of 

frequency * 2^32 / 180,000,000

When the Arduino gets a load of that, it pulls in a library that can handle a 64 bit result, adding 4K to the object code size.  I trimmed things so it would fit, but then would not be able to add "memories" or "scan" or have a bit of margin for other adjustments.  So I went back to the way it was.

It practical terms, it's not a big thing.  One Hz resolution is useful for measuring crystal parameters and most crystals we'll be doing will be in the range of 3.579 MHz to maybe 12 MHz, sometimes a bit higher.  Over that range, the resolution will be 1 Hz or close to it.

I did a quick check to see that all functions still work, but I'm sure a few sneaky bugs got by me, so let me hear about them.

Now, back to hardware.

73,

Nick, WA5BDU